package com.zhangmeng.online.exam.ui.admin;

import com.zhangmeng.online.exam.ui.components.ExamButtonComponent;
import com.zhangmeng.online.exam.ui.components.ExamComponent;
import javafx.scene.control.SplitPane;
import javafx.scene.layout.AnchorPane;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zm
 * @date 2025/3/21 14:08
 * @version: 1.0
 */
public class PaperPage extends AnchorPane {

    private Map<String, Object> context = new HashMap<>();

    public void setContext(Map<String, Object> context) {
        this.context = context;
    }

    public Map<String, Object> getContext() {
        return context;
    }

    private SplitPane splitPane;
    public PaperPage(Map<String, Object> context) {
        setContext(context);
        ExamComponent examComponent = new ExamComponent(context);
        ExamButtonComponent examButtonComponent = new ExamButtonComponent(examComponent.getTotalCount(),examComponent);
        examButtonComponent.setMaxWidth(300);
        examButtonComponent.setMinWidth(200);

        splitPane = new SplitPane();

        splitPane.getItems().addAll(examButtonComponent,examComponent);
        this.getChildren().add(splitPane);
        splitPane.prefWidthProperty().bind(this.widthProperty());
        splitPane.prefHeightProperty().bind(this.heightProperty());
    }
}
